<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>

https://blog.csdn.net/fangwenzheng88/article/details/78842831
<br>
https://blog.csdn.net/weixin_46058921/article/details/122387516

<form action="" method="get" id="myform">
<table width="98%" border="1">
  <tbody>
    <tr>
      <td align="right">账号</td>
      <td><input type="text" name="username" id="username" value="zhangsan"></td>
    </tr>
    <tr>
      <td align="right">密码</td>
      <td><input type="text" name="password" id="password" value="123456"></td>
    </tr>
    <tr>
      <td align="right">头像</td>
      <td><input type="file" name="avatar" id="avatar"></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input type="button" value="提交" id="to_submit"></td>
    </tr>
    
  </tbody>
</table>
</form>

<script src="jquery.js"></script>
<script>
$(document).ready(function(e) {
    $('#to_submit').click(function(){
		var formdata=new FormData($('#myform').get(0));
		formdata.append('test','123');
		$.ajax({
			url:'server.php',
			type:'post',
			dataType:'json',
			data:formdata,
			cache:false,
			processData:false,
			contentType:false,
			success:function(data){
				console.log(data);	
			}	
		});	
	});
});
</script>
</body>
</html>
